

package com.android.ringing.adapter;

import java.util.ArrayList;
import java.util.List;

import com.android.ringing.R;


import android.content.Context;


public class OnlineOrLocalAdapter extends IconListAdapter {

	public final static int LOCAL_RINGING	= 0;
	public final static int ONLINE_RINGING  = 1;
	
	

	public OnlineOrLocalAdapter(Context context, int mode) {
		super(context, getData(mode, context));
		
	}

	public int buttonToCommand(int whichButton) {
		AttachmentListItem item = (AttachmentListItem) getItem(whichButton);
		return item.getCommand();
	}

	protected static List<IconListItem> getData(int mode, Context context) {
		List<IconListItem> data = new ArrayList<IconListItem>(3);
	
		addItem(data,context.getString(R.string.local),R.drawable.arrowhead_01, LOCAL_RINGING);
		addItem(data,context.getString(R.string.online),R.drawable.arrowhead_01, ONLINE_RINGING);

		return data;
	}

	protected static void addItem(List<IconListItem> data, String title,
			int resource, int command) {
		AttachmentListItem temp = new AttachmentListItem(title, resource,
				command);
		data.add(temp);
	}

	public static class AttachmentListItem extends IconListAdapter.IconListItem {
		private int mCommand;

		public AttachmentListItem(String title, int resource, int command) {
			super(title, resource);

			mCommand = command;
		}

		public int getCommand() {
			return mCommand;
		}
	}
}
